package com.finger.gulimall.product.vo;

import com.baomidou.mybatisplus.annotation.TableId;
import com.finger.common.valid.AddGroup;
import com.finger.common.valid.ListValue;
import com.finger.common.valid.UpdateGroup;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

@Data
public class AttrVO {

    /**
     * 属性id
     */
    @NotNull(message = "修改属性不能为空", groups = {UpdateGroup.class})
    @Null(message = "修改属性必须为空", groups = {AddGroup.class})
    @TableId
    private Long attrId;
    /**
     * 属性名
     */
    @NotBlank(message = "属性名不能为空", groups = {AddGroup.class})
    private String attrName;
    /**
     * 是否需要检索[0-不需要，1-需要]
     */
    @NotNull(message = "检索不能为空", groups = {AddGroup.class})
    @ListValue(message = "检索只能为0或1", groups = {AddGroup.class, UpdateGroup.class}, vals = {0, 1})
    private Integer searchType;
    /**
     * 属性图标
     */
    @NotBlank(message = "属性图标不能为空", groups = {AddGroup.class})
    private String icon;
    /**
     * 可选值列表[用逗号分隔]
     */
    @NotBlank(message = "可选值列表不能为空", groups = {AddGroup.class})
    private String valueSelect;
    /**
     * 属性类型[0-销售属性，1-基本属性，2-既是销售属性又是基本属性]
     */
    @NotNull(message = "属性类型不能为空", groups = {AddGroup.class})
    @ListValue(message = "属性类型必须合法", groups = {AddGroup.class, UpdateGroup.class}, vals = {0, 1, 2})
    private Integer attrType;
    /**
     * 启用状态[0 - 禁用，1 - 启用]
     */
    @NotNull(message = "启用状态不能为空", groups = {AddGroup.class})
    @ListValue(message = "启用状态只能为0或1", groups = {AddGroup.class, UpdateGroup.class}, vals = {0, 1})
    private Integer enable;
    /**
     * 所属分类
     */
    @NotNull(message = "所属分类Id不能为空", groups = {AddGroup.class})
    private Long catelogId;
    /**
     * 快速展示【是否展示在介绍上；0-否 1-是】，在sku中仍然可以调整
     */
    @NotNull(message = "分组Id不能为空", groups = {AddGroup.class})
    @ListValue(message = "快速展示只能为0或-1", groups = {AddGroup.class, UpdateGroup.class}, vals = {0, 1})
    private Integer showDesc;

    /**
     * 分组Id
     */
    private Long attrGroupId;
    /**
     * 值类型【0只能单个值，1可以多个值】
     */
    @NotNull(message = "分组Id不能为空", groups = {AddGroup.class})
    @ListValue(message = "值类型【只能为0或1", groups = {AddGroup.class, UpdateGroup.class}, vals = {0, 1})
    private Integer valueType;

}
